layui.use(['layer','table','jquery'], function(){
    var table = layui.table;
    var layer = layui.layer;
    var $ = layui.jquery;

    //刷新
    refresh = function refresh(){
        location.reload();
    }

    //返回
    $('#goBack').click(function () {
        var title = $('#title').text();
        var iframe = parent.$('.iframe');
        $.each(iframe,function (i,item) {
            if(title == $(item).attr('_href')){
                parent.$('#beforeHref').val($(item).attr('_href'));
                parent.beforeHref();
                return;
            }
        });
    });
    $.ajax({
        url:"/loginRecord/getLoginRecordAll",
        type:"post",
        dataType:"json",
        success:function (data) {
            //表的渲染
            table.render({
                elem: '#demoTable',
                data:data.data,
                limit:10,
                title:"登录日志",
                width:1400,
                page:{
                    layout:['count','prev','page','next','limit','skip','refresh'],
                    limits:[10,20,30],
                    first:"首页",
                    last:"尾页",
                },
                cols: [[ //表头
                    {field: 'loginDate', title: '登录时间', width:460, align: 'center'},
                    {field: 'loginIp', title: '登录IP', width:466, align: 'center'},
                    {field: 'loginAddress', title: '登录地区', width:468 , align: 'center'}
                ]]
            });
        }

    })

});